Inside Macintosh: Macintosh Toolbox Essentials

Previous | Chapter Top | Chapter Contents | Next

Window Definition Function Type and Macros

The Window Manager calls your window definition function when it needs to draw any specialized window types you have defined for your application. The Window Manager supplies window definition functions that handle the standard window types.

The Window Manager defines a window definition function as follows:

typedef pascal long (*WindowDefProcPtr)(
                                         short varCode,
                                         WindowPtr theWindow,
                                         short message,
                                         long param);

For information about writing a window definition function, see "Application-Defined Function" .

Since you normally store a window definition function in a resource, you don't typically have to deal with it directly; the Window Manager loads it and calls it when necessary. Therefore, most programmers don't need the information in the remainder of this section.

The Window Manager defines the universal procedure pointer WindowDefUPP for identifying a window definition function:

typedef UniversalProcPtr WindowDefUPP;

The Window Manager defines the macro NewWindowDefProc for obtaining a WindowDefUPP :

#define NewWindowDefProc(userRoutine)\
        (WindowDefUPP) NewRoutineDescriptor((ProcPtr)(userRoutine),
         uppWindowDefProcInfo, GetCurrentArchitecture())

The Window Manager also defines the macro CallWindowDefProc for calling a WindowDefUPP :

#define CallWindowDefProc(userRoutine, varCode, theWindow, message, param)\
        CallUniversalProc((UniversalProcPtr)(userRoutine), uppWindowDefProcInfo,
        (varCode), (theWindow), (message), (param))

For more information about universal procedure pointers and the Mixed Mode Manger, see Inside Macintosh: PowerPC System Software.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next